<?php

require '../conn.php';

require 'config.php';

require '../inc/function.php';

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" href="../css/admin.css" type="text/css" />

<script type="text/javascript" src="inc/function.js"></script>

<script type="text/javascript" src="../fy_ckeditor/ckeditor.js"></script>

</head>

<body>

<?php

if ($act=='add'){

	$n_class=ReStra($_POST['n_class']);

	$n_index=ReStra($_POST['n_index']);

	$n_title=ReStra(trim($_POST['n_title']));
  
	$n_image=ReStra($_POST['n_image']);
  	$n_guige=$_POST['n_guige'];

 	$n_content=$_POST['n_content'];
	$n_order=ReStra($_POST['n_order']);

	$k_name=ReStra($_POST['k_name']);

	$k_keyword=ReStra($_POST['k_keyword']);

	$k_description=ReStra($_POST['k_description']);

 
	

	$sql="insert into ".$language."_pro(n_class,n_title,n_image,n_guige,n_content,k_name,k_keyword,k_description,n_order) 

	values($n_class,'$n_title','$n_image','$n_guige','$n_content','$k_name','$k_keyword','$k_description',$n_order)";

	mysql_query($sql) or die(mysql_error($sql));

	Msg('添加产品成功！','');

}

?>

<div id="container">

  <div class="edit">

      <h1>产品管理<a href="javascript:location.reload();">刷新</a></h1>

      <form method="post" action="?act=add" onsubmit="return CheckNews(this);">

        <table width="100%" border="0" cellpadding="0" cellspacing="0">

          <tr>

            <td class="edit_title">产品分类：</td>

            <td>
            
              <select name="n_class" >
            	<option value="0" <?php if($row['n_sid']==0) {?> elected="selected" <?php }?>>无</option>
                	<?php

			$query=mysql_query('select * from '.$language.'_pro_class where n_sid=0 order by n_order,n_id');

			if (mysql_num_rows($query)>0){

			while($row=mysql_fetch_array($query)){
			?>
       
           <option value="<?php echo $row['n_id']?>" ><?php echo $row['n_name']?></option>
            
				<?php
                $query2=mysql_query('select * from '.$language.'_pro_class where n_sid='.$row['n_id'].' order by n_order,n_id');
    
                if (mysql_num_rows($query2)>0){
    
                while($row2=mysql_fetch_array($query2)){
                ?>
                <option value="<?php echo $row2['n_id']?>" >&nbsp;&nbsp;--<?php echo $row2['n_name']?></option>
                
         
                    <?php
                   
				    
                     
 
                }
    
                }

    
			}

			}

			

			?>
            </select>
            </td>

          </tr>

          <tr>

            <td class="edit_title">产品标题：</td>

            <td><input type="text" name="n_title" class="inputtext" size="100" maxlength="255" /></td>

          </tr>


<tr>

            <td class="edit_title">缩略图片：</td>

            <td><input type="text" name="n_image" id="n_image" class="inputtext" size="50"  />
            &nbsp;(图片尺寸：600x400)
            <iframe src="../upload_fy.php?file_type=0&file_id=n_image" frameborder="0" allowtransparency="true" scrolling="no" width="100%" height="25"></iframe></td>

          </tr>
          
      
                        
          <tr>

            <td class="edit_title">规格：</td>

            <td><div class="edit_contents"><textarea name="n_guige" class="ckeditor"></textarea></div></td>

          </tr>
          
                  
          <tr>

            <td class="edit_title">详情：</td>

            <td><div class="edit_contents"><textarea name="n_content" class="ckeditor"></textarea></div></td>

          </tr> 
          
          
     
    


		  <tr>

            <td class="edit_title">Title：</td>

            <td><input type="text" name="k_name" class="inputtext" style="width:98%" maxlength="255" /></td>

          </tr>

          <tr>

            <td class="edit_title">Keyword：</td>

            <td><input type="text" name="k_keyword" class="inputtext" style="width:98%" maxlength="255" /></td>

          </tr>

          <tr>

            <td class="edit_title">description：</td>

            <td><input type="text" name="k_description" class="inputtext" style="width:98%" maxlength="255" /></td>

          </tr>

<tr>

            <td class="edit_title">排序：</td>

            <td><input type="text" name="n_order" class="inputtext" value="<?php echo RsNum('select n_id from '.$language.'_pro')+1 ?>" size="10" maxlength="10" /></td>

          </tr>


          <tr>

            <td class="edit_title" height="30">&nbsp;</td>

			<td><input type="submit" name="button" class="button" value=" 添加 " /></td>

          </tr>

        </table>

    </form>

    </div>

</div>

</body>

</html>